﻿using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp12
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable hashtable = new Hashtable();
            hashtable.Add(1,"Psycho");
            hashtable.Add(2, "HIP");
            hashtable.Add(3, "Fallin'Flower");
            hashtable.Add(4, "WANNABE");
            hashtable.Add(5, "Kill the love");
            Console.WriteLine("请输入歌曲编号：");
            int num = int.Parse(Console.ReadLine());
            bool id = hashtable.ContainsKey(num);
            if (id)
            {
                Console.WriteLine("歌曲名为：{0}",hashtable[num].ToString());
            }
            else
            {
                Console.WriteLine("该编号不存在");
            }
            Console.WriteLine("所有的歌曲信息：");
            foreach(DictionaryEntry dic in hashtable)
            {
                int key = (int)dic.Key;
                string value = dic.Value.ToString();
                Console.WriteLine("歌曲编号：{0}，歌曲名称：{1}",key,value);

            }
        }
    }
}
